
# 首次编译生成 tmp.build
ifeq ($(KERNELRELEASE),)
$(lib_static):
	@echo " tmp.build notexist, retry build " $@
	make -f $(TOPDIR)/mk/extapp.mk $@ KERNELRELEASE=TEST

$(lib_dynamic):
	@echo " tmp.build notexist, retry build " $@
	make -f $(TOPDIR)/mk/extapp.mk $@ KERNELRELEASE=TEST

$(program):
	@echo " tmp.build notexist, retry build " $@
	make -f $(TOPDIR)/mk/extapp.mk $@ KERNELRELEASE=TEST
	
	
# 文件存在
else

include tmp.build


# 编译静态库
#   -q 表示想已经存在的静态文件追加 .o 文件
#
$(lib_static):
	@echo " ====> static " 
	$(if $(KBUILD_VERBOSE:1=),@) $(AR) $(ARFLAGS) $@ $(tmp-objs-y)
	@ # 更新静态库的符号索引表 
	$(if $(KBUILD_VERBOSE:1=),@) $(RANLIB) $@

# 编译动态库
$(lib_dynamic):
	echo " ====> dynamic  "   
	echo $(objs-y)
	$(if $(KBUILD_VERBOSE:1=), @)  $(CC) $(CFLAGS) -o  $@  $(tmp-objs-y) $(LD_PATH) $(LD_LIB) 

# 编译程序
$(program):
	echo "program  "   
	$(eval $(call TRAVERSE, objs-y))
	$(if $(KBUILD_VERBOSE:1=), @) $(CC) -o $(program) $(OBJFLAGS) $(IFLAGS) $(tmp-objs-y) $(LD_PATH) $(LD_LIB) 

endif